import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/layouts/Layout'
Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      component: Layout,
      children: [
        {
          path: 'login',
          name: 'Login',
          component: () => import('@/views/Login')
        },
        {
          path: '404',
          name: 'Page404',
          component: () => import('@/views/errorPage/404')
        },
        {
          path: '503',
          name: 'Page503',
          component: () => import('@/views/errorPage/503')
        },
        {
          path: '',
          redirect: { name: 'Food' }
        }
      ]
    },
    {
      path: '/',
      name: 'Admin',
      component: () => import('@/layouts/AdminLayout'),
      children: [
        {
          path:'food',
          name: 'Food',
          component: () => import('@/views/Home')
        },
        {
          path:'find',
          name: 'Find',
          component: () => import('@/views/Home')
        },
        {
          path:'order',
          name: 'Order',
          component: () => import('@/views/Home')
        },
        {
          path:'self',
          name: 'Self',
          component: () => import('@/views/Home')
        }
      ]
    }
  ]
})
